﻿namespace FallingRocks
{
    public abstract class GameObject : IRenderable
    {
        protected GameObject(Position position, char[] visualisation, Position speed, Color color)
        {
            this.Position = position;
            this.Visualisation = visualisation;
            this.Speed = speed;
            this.Color = color;
        }

        public Position Position { get; protected set; }
        
        public char[] Visualisation { get; protected set; }

        public Position Speed { get; protected set; }

        public Color Color { get; protected set; }       

        public virtual void Update()
        {
            this.UpdatePosition();
        }

        public abstract bool CanCollideWith(GameObject gameObject);

        public abstract bool RespondToCollision(GameObject gameObject);

        protected virtual void UpdatePosition()
        {
            this.Position += this.Speed;
        }  
    }
}